<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<link href="themes/css/ui.common.css" rel="stylesheet" type="text/css" />
		<link href="themes/css/ui.child.css" rel="stylesheet" type="text/css" />
		<link href="themes/css/ui.tips.css" rel="stylesheet" type="text/css" />
		<link href="style/jquery_ui/jquery-ui-1.8.custom.css" rel="stylesheet"
			type="text/css" />
		<link id="skin_css" type="text/css" rel="stylesheet"
			href="themes/css/ui.c.blue.css" />
		<link rel="stylesheet" type="text/css"
			href="themes/default/pagination.css" />
		<link href="themes/css/ui.selector.css" rel="stylesheet"
			type="text/css" />
		<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
		<script src="Scripts/jquery-ui-1.8.custom.min.js"
			type="text/javascript"></script>
		<script src="Scripts/jquery.json-2.2.min.js" type="text/javascript"></script>
		<script src="Scripts/ui.tips.js" type="text/javascript"></script>
		<script src="Scripts/ui.default.js " type="text/javascript"
			charset="UTF-8"></script>
		<script src="Scripts/ui.admincp.js" type="text/javascript"
			charset="UTF-8"></script>
		<script src="Scripts/ui.objectSelector.js" type="text/javascript"></script>
		<script type="text/javascript" src="Scripts/ui.clientDateHelper.js"></script>
		<script type="text/javascript" src="Scripts/ui.dialogFormHelper.js"></script>

		<STYLE type="text/css">
.editorArea {
	display: none;
}

tr {
	margin-bottom: 5px;
}
</STYLE>
		<script type="text/javascript">
				$(function(){
			
			
			$("#dialog").dialog("destroy"); 
			$("#dialog-form").dialog({
			autoOpen: false,
			height: 550,
			width: 760,
			modal: true, 
			close: function() {
				//allFields.val('').removeClass('ui-state-error');
			}
			});
			
			$('#addAssessInfoButton').click(function() {  
			     $('#dialog-form').dialog('open'); 

				
			});
			
			$("#peopleSelectorArea").objectSelector({
                fromAjax: true,
                ajaxDataAction: "move!getPersonBySectionId.action",
                subGroupBuilder: subGroupBuilder,
                postArgBuilder :function(entityId){ return {sectionId: entityId};}
			});
			
			    
	});
		   function subGroupBuilder(item) {
       	 
            var sectionId = item.archiveInfo.postInfo.sectionInfo.sectionId;
            var name = item.archiveInfo.staffName;
            var staffId = item.staffId;
            var info = item.archiveInfo.gender;
            var groupId = sectionId;
            return '<div class="groupItem"><a class="lm_addr" key="g' + sectionId + '" href="javascript:void(0)"><input type="button" class="move" />'
            + '<div class="arguementBar" key="g' + sectionId  + '" entityId="' + staffId + '" itemindex="0" title="">'
            + name + ' <span class="details Tips3">' + info + '</span></div></a></div>';
        }
		    
				
		function doDialogSubmit(){
		    var assessName = $("#dialog-assessInfo-name").val();
		    var modelId = $("#dialog-assessInfo-modelName").val();
		    var year = $("#dialog-assessInfo-year").val();
		    var month = $("#dialog-assessInfo-month").val();
		 	var peopleSelected =  "";
		    $("#peopleSelectorArea").find(".rightContainer:first").find(".arguementBar").each(function(item){
		        peopleSelected+= $(this).attr("entityId")+"," ;
		         
		    });
		    var _result = { 
		        assessName:assessName,
		        modelId:modelId,
		        yearNo:year,
		        monthNo :month,
		        staffIds:peopleSelected
		    };
		   
		    var result = $.toJSON(_result);
		    $.post("assessInfo!addInfo.action",{result:result},function(e){location="assessInfo!manager.action?add=1";
		    },"json");
		}
		    
 
			var searching = false;
				$(function(){
					$("#link_page_prev,#link_page_next").click(function(){
			    		var currentPage = $(this).attr("currentPage");
			    	 
			    		goToPage(currentPage);
			    	}); 
			    	
			    	$("#searchButton").click(function(){
						searching=true;
			    		goToPage(1);
			    	});
			    	
			    	initSearch();
			    	registeRowFuncButton();
				});
				
				function initSearch()
				{
				    $("#txt_noticeTitle").val();
				}
			 
				function goToPage(currentPage)
				{
				
				    var assessName = $("#txt_assessName").val();
				    var modelName = $("#txt_modelName").val(); 
				    var yearNo = $("#yearNo").val();
				    var monthNo = $("#monthNo").val(); 			   
		location.href = "assessInfo!manager.action?currpage="+currentPage+"&assessName="+assessName+"&modelName="+modelName + "&yearNo="+yearNo + "&monthNo="+monthNo;
				}  
				
	        function toShowDetailHandler(e) {  
				var columns = e.data;
				var assessId = e.entityId;
				
				
				location.href = "assessInfo!editDetail.action?assessId="+assessId;
				}
				
				function checkAll(str)
				{
　 					var items = document.getElementsByName(str);　 //获取所有复选框
　					var totalNum = items.length;　 //获取复选框的个数
　 					for (var i=0; i<totalNum; i++)
　 					items[i].checked = window.event.srcElement.checked;//通过单击的按钮判断是选中还是未选
				}
				
				function deleteAll(str)
				{
					var isTo = checkDeleteAll("考核信息记录");

					if(isTo==false)
  					return ;
　 					var items = document.getElementsByName(str);　 //获取所有复选框
　					var totalNum = items.length;　 //获取复选框的个数
					var delStr = "";
　 					for (var i=0; i<totalNum; i++){
　 						if(items[i].checked == true){
							delStr += items[i].value + ","; 
						}
					}
					delStr = delStr.substring(0, delStr.length -1);
					
					location.href= "assessInfo!deleteMore.action?assessIds="+delStr+"&currpage="+${currpage};
				}
			</SCRIPT>
	</head>


	<body>
	<div class="PageChild_Title">
        <img src=" themes/images/default/icons/archives.png" class="PageChild_Tbtnpic" />
        <span class="PageChild_separate"></span><span class="PageChild_TbtnText">
        <h2>
        	管理考核信息
        </h2>
        </span><span class="PageChild_separate"></span>
        <div id="marker" class="red-tips">
        </div>
        <div class="clear">
        </div>
    </div>
		<div class="PageChild_Where">
			<table style="height: 60px" border="0" cellpadding="0"
				cellspacing="0">
				<tr>
					<td class="mtd">
						&nbsp;考核信息名称:<s:textfield name="assessName" maxlength="20" id="txt_assessName"
							theme="simple" />
					</td>
					<td class="mtd">
						&nbsp;考核模版名称:<s:textfield name="modelName" maxlength="20" id="txt_modelName"
							theme="simple" />
					</td>
					<td class="mtd">
						&nbsp;考核月份:<s:select id="monthNo" theme="simple" list="listMonth" label="abc" headerKey="-10" headerValue="--按考核月份查看--" value="monthNo"></s:select>
					</td>
					<td class="mtd">
						&nbsp;考核年份:<s:select id="yearNo" theme="simple" list="listYear" label="abc" headerKey="-10" headerValue="--按考核年份查看--" value="yearNo"></s:select>
					</td>
					<td>
					<input type="submit" name="searchButton" class="o-btn SubmitButton" value="搜索"
							id="searchButton" />
					</td>
				</tr>
				<tr>
					<td>
					&nbsp;<input type="button" id="addAssessInfoButton" class="o-btn"
							value="添加" />
					</td>
				</tr>
				<tr>
					<td colspan="5">
					&nbsp;<span id="lbl_list_count">共有 <b>${count}</b> 条考核信息。</span>
					</td>
				</tr>
			</table>
		</div>
		<div class="PageChild_List">
			<table width="100%" border="0" cellspacing="0"
				style="text-align: left">
				<tbody class="PageChild_List_head">
					<tr>
						<td width="16">
							<input id="Chk_All" type="checkbox" name="Chk_All"
								onclick="checkAll('Chk_Num')" />
						</td>
						<td>
							考核信息名称
						</td>
						<td>
							考核模版名称
						</td>
						<td>
							考核信息年份
						</td>
						<td>
							考核信息月份
						</td>
						<td class="td_width40">
							编辑
						</td>
						<td class="td_width40">
							删除
						</td>
					</tr>
				</tbody>
				<tbody class="PageChild_List_main" style="text-align: left">
					<!-- 考核信息列表开始 -->
					<s:if test="list!=null&&list.size!=0">
					<s:iterator value="list" var="item">
						<tr class='td_no_bord'>
							<td class="td_width25">
								<span title="${item.assessId}"><input id="Chk_Num" type="checkbox"
										name="ReptShow$ctl01$Chk_Num" value="${item.assessId}" /> </span>
							</td>
							<td>
								<span>${item.assessName}&nbsp;</span>
							</td>
							<td>
								<span> ${item.assessModel.modelName}&nbsp; </span>
							</td>
							<td>
								<span> ${item.yearNo}&nbsp; </span>
							</td>
							<td>
								<span> ${item.monthNo}&nbsp; </span>
							</td>
							<td>
								<a class="ui-link-viewDetail-button" entityId="${item.assessId}"
									id="sender_${item.assessId}" href="javascript:void(0);"
									state="0" entityId="${item.assessId}"> <img
										src="<%=basePath%>/themes/icons/edit.png" title="单击查看考核信息详情" />
								</a> &nbsp;
							</td>
							<td>
								<a href="javascript:;"
									onclick='location="assessInfo!delete.action?assessId=${item.assessId}&currpage=${currpage}";'><img
										src="<%=basePath%>/themes/icons/delete.png" title="单击删除考核信息" />
								</a> &nbsp;
							</td>
						</tr>
					</s:iterator>
					</s:if><s:else>
					<tr>
						<td	colspan="7">无记录</td>
					</tr>
					</s:else>
					<!-- 考核信息列表结束 -->

				</tbody>
			</table>
			<div id="divTopPageNavi" class="list_r_title_text3">

				<!--分页导航开始-->
				<s:if test="currpage<=1">
					<span class='list_r_title_text3a'> <img
							src="<%=basePath%>/themes/images/default/page_up_gray.gif"></img>
					</span>

				</s:if>
				<s:else>
					<span class='list_r_title_text3a'> <a name="link_page_prev"
						id="link_page_prev" href="javascript:void(0);"
						currentPage="${currpage-1}"> <img
								src="<%=basePath%>/themes/images/default/page_up.gif"></img> </a> </span>
				</s:else>
				<span class='list_r_title_text3b'> 第${currpage
					}页/共${totalpage }页 </span>
				<s:if test="currpage>=totalpage">
					<span class='list_r_title_text3a'> <img
							src="<%=basePath%>/themes/images/default/page_down_gray.gif"></img>
					</span>
				</s:if>
				<s:else>
					<span class='list_r_title_text3a'> <a name="link_page_next"
						id="link_page_next" href="javascript:void(0);"
						currentPage="${currpage+1 }"> <img
								src="<%=basePath%>/themes/images/default/page_down.gif"></img> </a>
					</span>
				</s:else>
				<span id="goToPageTextArea"><input type="text"
						class="easyui-numberbox" id="goPageNum" max="${totalpage}" min="1" />
					<input type="button" id="turnToPageButton" value="GO" /> </span>
				<!--分页导航结束-->
			</div>
			<div>
				<input type="button" name="btn_Delete" class="o-btn SubmitButton"
					value="删 除" id="btn_Delete"
					onclick="deleteAll('ReptShow$ctl01$Chk_Num')">
			</div>
		</div>

		<div id="dialog-form" title="通知详情" style="padding: 10px;">
			<table width="100%" border="0" cellspacing="0">
				<tr>
					<td class="mtd" width="100px;" style="height: 26px">
						考核信息名称:
					</td>
					<td valign="center" style="">
						<input type="text" value="" class="input-control"
							style="width: 200px;" id="dialog-assessInfo-name" />
					</td>
				</tr>
				<tr>
					<td class="mtd" width="100px;" style="height: 26px">
						考核模板名称:
					</td>
					<td>
						<s:select id="dialog-assessInfo-modelName" theme="simple"
							list="listAssessModel" listKey="modelId" listValue="modelName"
							headerKey="0" headerValue="--选择考核模版--" value=""></s:select>
					</td>
				</tr>
				<tr>
					<td class="mtd" width="100px;" style="height: 26px">
						考核信息年份:
					</td>
					<td currentYear="${currentYear}">
						<s:select id="dialog-assessInfo-year" theme="simple"
							list="listYear" headerKey="%{currentYear}"
							headerValue="%{currentYear}" value=""></s:select>
					</td>
				</tr>
				<tr>
					<td class="mtd" width="100px;" style="height: 26px">
						<b>考核信息月份:</b>
					</td>
					<td>
						<s:select id="dialog-assessInfo-month" theme="simple"
							list="listMonth" headerKey="%{currentMonth}" headerValue="%{currentMonth}"
							value=""></s:select>
					</td>
				</tr>
				<tr>

					<td class="mtd" width="100px;" style="height: 26px">
						考核人员:
					</td>
					<td>
						<div id="peopleSelectorArea" selectorresult="#txt_PeopleReceiver"
							style="">
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td valign="top">
										<span>部门人员列表:</span>
										<div class="Box leftContainer"
											style="overflow-y: auto; height: 302px;">
											<div class="lm_sbar hiddenObject">
												<input type="button" class="lm_sopen" style="" />
												<div>
													<input type="text" style="height: 19px;" value="查找人员..."
														class="txt" />
												</div>
											</div>
											<div style="display: none">
												查找到以下结果:
												<div>
												</div>
											</div>
											<div class="lm_panel hiddenObject" style="">
											</div>
											<div class="lm_panel" style="height: 100%;">
												<s:iterator value="sectionList" var="item">
													<div class="groupclose" key="g${item.sectionId }"
														entityId="${item.sectionId }" open="false" hasload="false"
														style="font-weight: bolder;">
														<div
															style="padding: 2px 0pt 1px; background: none repeat scroll 0% 0% rgb(255, 255, 255); color: black;"
															onmouseout="this.style.background='#fff'"
															onmouseover="this.style.background='#ffeec2'" class="">
															<div class="clear"></div>
															<span class="Tips3 lm_helper">全部添加</span>
															<div class="lm_ca" title="${item.sectionName}">
																<input type="button" class="lm_ico" />
																${item.sectionName}
																<span class="Tips3 groupItemCountTips"
																	id="groupTips_${item.sectionId }">(未加载)</span>
															</div>
														</div>
													</div>
													<div class="groupsub" key="g${item.sectionId }">
													</div>
												</s:iterator>

											</div>
										</div>
									</td>
									<td align="center" style="padding: 5px;">
										<img alt="" src="style/arrow_left.gif" />
									</td>
									<td valign="top">
										<span>已选择(<span id="count_Receiver"
											class="receiverCounter">0</span>)</span>
										<div id="add_address"
											style="overflow-y: auto; height: 302px; padding-left: 3px;"
											class="Box objectSelectorContainer rightContainer">
										</div>
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
			</table>
			<input type="button" name="name" id="btnSubmit"
				onclick="return doDialogSubmit();" value="确定" />

			<input type="button" name="name" id="cancelAddGoodsInfoButton"
				class="dialogFormCloseButton" dialogForm="#dialog-form" value="取消" />
		</div>
	</body>
</html>
